home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / DCLAP 6d / dclap6d / DClap / DWindow.h < prev   
Text File  |  1996-07-05  |  4KB  |  125 lines

  1. // DWindow.h
  2. // d.g.gilbert
  3.  
  4. #ifndef _DWINDOW_
  5. #define _DWINDOW_
  6.  
  7. #include "Dvibrant.h"
  8. #include "DView.h"
  9. #include "DMethods.h"
  10.  
  11. class DDialogText;
  12. class DList;
  13. class DFindDialog;
  14. class DFile;
  15.  
  16.  
  17. class DWindow : public DView
  18. {    
  19. public:
  20.     enum WindowStyles { document, fixed, frozen, round, alert, modal, floating, shadow, plain };
  21.     enum WindowConst { kDontFreeOnClose = false, kFreeOnClose = true };
  22.     Nlm_WindoW            fWindow;
  23.     DDialogText        * fEditText; // for use w/ cut/copy/paste/etc
  24.     DPrintHandler    *    fPrintHandler;
  25.     DSaveHandler    *    fSaveHandler;
  26.     Boolean                    fModal, fOkay, fFreeOnClose;
  27.     DFindDialog        * fFindDlog;
  28.     char                    *    fFilename;
  29.     
  30.     DWindow(long id, DTaskMaster* itsSuperior, WindowStyles style,
  31.                     short width = -5, short height = -5, short left = -50, short top = -20, 
  32.                     char* title = NULL, Nlm_Boolean freeOnClose= kFreeOnClose);
  33.     DWindow(long id, DTaskMaster* itsSuperior); // user of this MUST call Initialize()
  34.     virtual ~DWindow();
  35.  
  36.     virtual void InitWindow(WindowStyles style = fixed, 
  37.                     short width = -5, short height = -5, short left = -50, short top = -20, 
  38.                     char* title = NULL, Nlm_Boolean freeOnClose= kFreeOnClose);
  39.                     
  40.     virtual void Open();
  41.     virtual void Hide(); 
  42.     virtual void Close();
  43.     virtual void CloseAndFree();
  44.     virtual    void AddOkayCancelButtons( 
  45.             long okayId = cOKAY, char* okayName = "Okay",
  46.             long cancelId = cCANC, char* cancelName = "Cancel");
  47.  
  48.     virtual Boolean IsMyAction(DTaskMaster* action); // traps OKAY, CANC messages
  49.     virtual Boolean PoseModally();     // not really modal, just open/eventloop til close/return okayHit 
  50.     virtual void         OkayAction();     // override to handle 'OKAY' message
  51.  
  52.     virtual void PrintDoc();
  53.     virtual void SaveDoc(DFile* f);
  54.         
  55.     virtual void  Select();         // override
  56.         // activate()/deactivate() are not useful in x-win
  57.         // need an equivalent for all win systems, ???? what 
  58.     virtual void  Activate();
  59.     virtual void  Deactivate();
  60.     
  61.     virtual void  ResizeWin();
  62.     virtual void  CalcWindowSize();
  63.     
  64.     Boolean  HasEditText() { return (fEditText != NULL); }
  65.     void  SetEditText(DDialogText* theText) { fEditText= theText; }
  66.  
  67.     virtual void Erase();
  68.     virtual void Use();                    // useful way to activate a window ! 
  69.     virtual Boolean IsUsing();    // ??
  70.     virtual void Realize();            // == Nlm_DoShow(), which is good for what?? 
  71.     //virtual Boolean InFront();    // Mac only
  72.     virtual void SendToBack();  
  73.     virtual void BringToFront();  
  74.     
  75.     virtual char* GetFilename( char* name = NULL, ulong maxsize = 256);
  76.     virtual void  SetFilename( char* name);
  77. };
  78.  
  79.  
  80.  
  81.  
  82. class    DWindowManager    : public    DObject
  83. {
  84.     DList*    fWindows;
  85.     DWindow* fAppWindow;    // main-menu window for app, non-mac systems
  86.     DWindow* fLastActive;    // last current, non-main window (? non-modal...)
  87. public:
  88.     DWindowManager();
  89.     virtual ~DWindowManager();
  90.     
  91.     virtual void AddWindow(DWindow* theWin);
  92.     virtual void DeleteWindow(DWindow* theWin, Nlm_Boolean postDeleteTask = true);
  93.     virtual void SetAppWindow(DWindow* theWin);
  94.     virtual DWindow* GetAppWindow();
  95.     virtual void SetCurrent(DWindow* theWin);
  96.     virtual void UnsetCurrent(DWindow* theWin);
  97.     virtual DWindow*    CurrentWindow();    // all, but may not be accurate?
  98.     virtual DList* GetWindowList() { return fWindows; }
  99.  
  100.     virtual void SendToBack(DWindow* theWin = NULL); // if null, frontwin
  101.     virtual void BringToFront(DWindow* theWin = NULL); // if null, lastwin
  102.  
  103.             // these are not all useful in all win systems
  104.             // consolidate as one function CurrentWindow() that
  105.             // always returns the app's front/current/active window
  106.     //virtual DWindow*    FrontWindow();        // Mac, MSWin, NOT xwin
  107.     //virtual DWindow*    ActiveWindow();        // Mac, MSWin, NOT xwin
  108.  
  109.     virtual DWindow* WhichWindow(Nlm_PoinT mouse);     // Mac, MSWin, NOT xwin
  110.     virtual Boolean    InWindow(Nlm_PoinT mouse);             // Mac, MSWin, NOT xwin
  111.  
  112.     virtual DWindow* SavePort(DView* newport);
  113.     virtual void RestorePort(DWindow* savedwindow);
  114.     
  115.     virtual DDialogText* CurrentDialogText();
  116.  
  117.     virtual void    UpdateDisplays();
  118. };
  119.  
  120.  
  121. extern    DWindowManager*    gWindowManager;
  122.  
  123.  
  124. #endif
  125.